package org.jeecg.modules.zcgl.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

@Getter
@AllArgsConstructor
public enum PayRentTypeEnum {

    /**
     * RENTCZ：预存缴费 RENTJF：缴费
     */

    RENTCZ(1,"RENTCZ", "预存缴费"),
    RENTJF(0,"RENTJF", "缴费");

    Integer status;
    String key;
    String name;

    public static String getNameByKey(String key){
        if (StringUtils.isBlank(key)){
            return null;
        }
        for (PayRentTypeEnum mode : PayRentTypeEnum.values()){
            if (mode.getKey().equalsIgnoreCase(key)) {
                return mode.name;
            }
        }
        return null;
    }

    public static Integer getStatusByKey(String key){
        if (StringUtils.isBlank(key)){
            return null;
        }
        for (PayRentTypeEnum mode : PayRentTypeEnum.values()){
            if (mode.getKey().equalsIgnoreCase(key)) {
                return mode.status;
            }
        }
        return null;
    }
}
